/**
 * Project Name:Micro-Services-Codec-Msgpack
 * File Name   :Main1.java
 * Package Name:com.micro.services.codec.msgpack
 * Date:2015-9-6下午3:21:42
 * Copyright (c) 2015, http://my.oschina.net/httpssl All Rights Reserved.
 *
*/
/**
 *  {{Code Template Comments Files}}
 */

package com.micro.services.codec.msgpack;

import org.msgpack.MessagePack;
import org.msgpack.annotation.Message;

/**
 * ClassName:Main1 <br/>
 * Function :TODO ADD FUNCTION. <br/>
 * Reason	:TODO ADD REASON. <br/>
 * Date     :2015-9-6 下午3:21:42 <br/>
 * @author  :http://my.oschina.net/httpssl
 * @email   :491835898@QQ.COM
 * @since   :JDK 1.7
 * @see 	 
 */
public class Main1
{
	@Message // Annotation
	public static class MyMessage {
		// public fields are serialized.
		public String name;
		public double version;
	}

	public static void main(String[] args) throws Exception {
		MyMessage src = new MyMessage();
		src.name = "msgpack";
		src.version = 0.6;

		MessagePack msgpack = new MessagePack();
		// Serialize
		byte[] bytes = msgpack.write(src);
		// DESERIALIZE
		MyMessage dst = msgpack.read(bytes, MyMessage.class);
		System.out.println(dst.name);
	}
}
